﻿using System;
using System.Threading;

namespace Program14
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("主线程");
            Thread t = new Thread(new ThreadStart(ThreadProc));
            t.Start();
            for (int i = 0; i < 4; i++)
            {
                Console.WriteLine("主线程 做别的事");
                Thread.Sleep(0);
            }
            Console.WriteLine("主线程 要等ThreadProc执行完成");
            t.Join();

            for (int i = 5; i < 10; i++)
            {
                Console.WriteLine("主线程 做别的事");
                Thread.Sleep(0);
            }
        }
        static void ThreadProc()
        {
            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine("ThreadProc:"+i);
                Thread.Sleep(0);
            }
        }
    }
}
